package com.leyou.trade.utils;

public class UserHolder {

    private static final ThreadLocal<Long> TL = new ThreadLocal<>();

    public static void setUser(Long userId){
        TL.set(userId);
    }

    public static Long getUser(){

        Long id = TL.get();
        if(id == null){
            return 0L;
        }

        return id;
    }

    public static void removeUser(){
        TL.remove();
    }
}
